/**
 * 角色模块路由文件
 */

const Router = require('koa-router');
const router = new Router();
const { validaAdd, validAddMenus, validUpdate, validRoleId } = require('../validators/roles');
const { add, addRoleMenus, update, deleteRoleById, getList, getTeacherRoles } = require('../services/roles');
const { validate } = require('../validators/common');

router.prefix('/roles');

router.post('/add', validate(validaAdd), add);

router.post('/addmenus', validate(validAddMenus), addRoleMenus);

router.put('/update', validate(validUpdate), update);

router.delete('/delete/:id', validate(validRoleId), deleteRoleById);

router.get('/list', getList);

router.get('/teacherRoles/:id', getTeacherRoles);

module.exports = router;